package com.taxi.comm.business.service.M003;

import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

import com.taxi.comm.message.Request;




public class M003Request extends Request {

	

	public String YCPT;
	public String LXH;
	public String SBHM;
	public String YCZL;
	public String YCLX;
	public String CPH;
	public String YYZH;
	public String ZYZH;
	public String SJXM;
	public String CZGS;
	public String YCSJ;
	public String JDDDWD;
	public String JDDDJD;
	public String SHCSJ;
	public String SCDDWD;
	public String SCDDJD;
	public String SCDD;
	public String MPHM;
	public String KJLK;
	public String DBMC;
	public String XCSJ;
	public String XCDD;
	public String LC;
	public String DHSJ;
	public String CF;
	public String DDF;
	public String LQF;
	public String RYFJF;
	public String QTF;
	public String CKDH;
	public String SJDH;
	public String BZ;
	
	public int rownum;
	public List<M003ZFMX> m003zfmx;
	


	public void init(String xml) throws Exception{
		
		
		StringReader sr = new StringReader(xml);
	
		InputSource is = new InputSource(sr);
		DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
		DocumentBuilder builder = factory.newDocumentBuilder();
		Document doc = builder.parse(is);
		NodeList nl = doc.getElementsByTagName("SHCZ");
		
		Node node = nl.item(0);
		NamedNodeMap m1=node.getAttributes();
	    Node nodeAttri=m1.item(0);
	
		this.Ver=nodeAttri.getNodeValue();
		NodeList childNodes = node.getChildNodes();
		Node childNode = childNodes.item(0);
		NodeList childs = childNode.getChildNodes();
	
		for (int j = 0; j < childs.getLength(); j++) {

			Node child = childs.item(j);
			if (child.getNodeName().equals("BWLS")) {
				this.BWLS = child.getFirstChild().getNodeValue();
			
			}
			if (child.getNodeName().equals("BWLX")) {
				this.BWLX = child.getFirstChild().getNodeValue();
			
			}
			if (child.getNodeName().equals("QQBZ")) {
				this.QQBZ = child.getFirstChild().getNodeValue();
			
			}
			if (child.getNodeName().equals("YDDM")) {
				this.YDDM = child.getFirstChild().getNodeValue();
			
			}
			if (child.getNodeName().equals("FSF")) {
				this.FSF = child.getFirstChild().getNodeValue();
			
			}
			if (child.getNodeName().equals("JSF")) {
				this.JSF = child.getFirstChild().getNodeValue();
			
			}
			if (child.getNodeName().equals("SCSJ")) {
				this.SCSJ = child.getFirstChild().getNodeValue();
			
			
			}
			if (child.getNodeName().equals("BWXH")) {
				this.BWXH = child.getFirstChild().getNodeValue();
			
			}
			if (child.getNodeName().equals("XTMC")) {
				this.XTMC = child.getFirstChild().getNodeValue();
			
			}
            
			
		}
		childNode = childNodes.item(1);
		NodeList childs2 = childNode.getChildNodes();
		
		for (int k = 0; k < childs2.getLength(); k++) {

			Node child2 = childs2.item(k);
			
			if (child2.getNodeName().equals("YCPT")) {
				this.YCPT = child2.getFirstChild().getNodeValue(); 
			} 
			if (child2.getNodeName().equals("LXH")) {
				this.LXH = child2.getFirstChild().getNodeValue();
			}   
			if (child2.getNodeName().equals("SBHM")) {
				this.SBHM = child2.getFirstChild().getNodeValue();
			}  
			if (child2.getNodeName().equals("YCZL")) {
				this.YCZL = child2.getFirstChild().getNodeValue();
			}  
			if (child2.getNodeName().equals("YCLX")) {
				this.YCLX = child2.getFirstChild().getNodeValue();
			}  
			if (child2.getNodeName().equals("CPH")) {
				this. CPH = child2.getFirstChild().getNodeValue();
			}   
			if (child2.getNodeName().equals("YYZH")) {
				this.YYZH = child2.getFirstChild().getNodeValue();
			}  
			if (child2.getNodeName().equals("ZYZH")) {
				this.ZYZH = child2.getFirstChild().getNodeValue();
			}  
			if (child2.getNodeName().equals("SJXM")) {
				this.SJXM = child2.getFirstChild().getNodeValue();
			}  
			if (child2.getNodeName().equals("CZGS")) {
				this.CZGS = child2.getFirstChild().getNodeValue();
			}  
			if (child2.getNodeName().equals("YCSJ")) {
				this.YCSJ = child2.getFirstChild().getNodeValue();
			}  
			if (child2.getNodeName().equals("JDDDWD")) {
				this.JDDDWD = child2.getFirstChild().getNodeValue();
			}
			if (child2.getNodeName().equals("JDDDJD")) {
				this.JDDDJD = child2.getFirstChild().getNodeValue();
			}
			if (child2.getNodeName().equals("SCSJ")) {
				this.SHCSJ = child2.getFirstChild().getNodeValue();
				
			}  
			if (child2.getNodeName().equals("SCDDWD")) {
				this.SCDDWD = child2.getFirstChild().getNodeValue();
			}
			if (child2.getNodeName().equals("SCDDJD")) {
				this.SCDDJD = child2.getFirstChild().getNodeValue();
			}
			if (child2.getNodeName().equals("SCDD")) {
				this.SCDD = child2.getFirstChild().getNodeValue();
			}  
			if (child2.getNodeName().equals("MPHM")) {
				this.MPHM = child2.getFirstChild().getNodeValue();
			}  
			if (child2.getNodeName().equals("KJLK")) {
				this.KJLK = child2.getFirstChild().getNodeValue();
			}  
			if (child2.getNodeName().equals("DBMC")) {
				this.DBMC = child2.getFirstChild().getNodeValue();
			}  
			if (child2.getNodeName().equals("XCSJ")) {
				this.XCSJ = child2.getFirstChild().getNodeValue();
			}  
			if (child2.getNodeName().equals("XCDD")) {
				this.XCDD = child2.getFirstChild().getNodeValue();
			}  
			if (child2.getNodeName().equals("LC")) {
				this.LC = child2.getFirstChild().getNodeValue();
			}    
			if (child2.getNodeName().equals("DHSJ")) {
				this.DHSJ = child2.getFirstChild().getNodeValue();
			}  
			if (child2.getNodeName().equals("CF")) {
				this.CF = child2.getFirstChild().getNodeValue();
			}    
			if (child2.getNodeName().equals("DDF")) {
				this.DDF = child2.getFirstChild().getNodeValue();
			}   
			if (child2.getNodeName().equals("LQF")) {
				this.LQF = child2.getFirstChild().getNodeValue();
			}   
			if (child2.getNodeName().equals("RYFJF")) {
				this.RYFJF = child2.getFirstChild().getNodeValue();
			} 
			if (child2.getNodeName().equals("QTF")) {
				this.QTF = child2.getFirstChild().getNodeValue();
			}   
			if (child2.getNodeName().equals("CKDH")) {
				this.CKDH = child2.getFirstChild().getNodeValue();
			}  
			if (child2.getNodeName().equals("SJDH")) {
				this.SJDH = child2.getFirstChild().getNodeValue();
			}  
			if (child2.getNodeName().equals("BZ")) {
				this.BZ = child2.getFirstChild().getNodeValue();
			}   
			if (child2.getNodeName().equals("ZFMX")) {
				
				NamedNodeMap m3=child2.getAttributes();
				NodeList childs3 = child2.getChildNodes();
				
				
				Node nodeAttri1=m3.item(0);
				
			    this.rownum=Integer.parseInt(nodeAttri1.getNodeValue(), 10);
			    
			   
				this.m003zfmx=new ArrayList<M003ZFMX>();
				for (int h = 0; h < childs3.getLength(); h++) {
					M003ZFMX m = new M003ZFMX();
					Node child3 = childs3.item(h);
					
					if (child3.getNodeName().equals("Row")) {
						NamedNodeMap RowNode=child3.getAttributes();
						for(int n=0;n<8;n++){
							Node attrnode=RowNode.item(n);
							
							if (attrnode.getNodeName().equals("XH"))
							{
								m.XH  = attrnode.getNodeValue();
								
							}
							if (attrnode.getNodeName().equals("ZFFS")) 
							{
								m.ZFFS  = attrnode.getNodeValue();
							} 
							if (attrnode.getNodeName().equals("ZFJE")) 
							{
								
								m.ZFJE  = attrnode.getNodeValue();
								
							} 
							if (attrnode.getNodeName().equals("YHJE")) {
								m.YHJE  = attrnode.getNodeValue();
							} 
							if (attrnode.getNodeName().equals("JLJE")) {
								m.JLJE  = attrnode.getNodeValue();
							} 
							if (attrnode.getNodeName().equals("ZFZH")) {
								m.ZFZH  = attrnode.getNodeValue();
							} 
							if (attrnode.getNodeName().equals("ZFLSH")) {
								m.ZFLSH  = attrnode.getNodeValue();
							}
							if (attrnode.getNodeName().equals("BZ")) {
								m.BZ  = attrnode.getNodeValue();
							}
						}
						m003zfmx.add(m);
						
					} 
					
					
					
				
				}
				
			}


		}
		
	}

}
